import store from '@/store'

// form
// 默认表单对象
export const defaultForm = {}

// 表单项配置
export const formBase = [
  {
    label: '单号',
    type: 'input',
    field: 'courierNumber',
    required: true
  },
  {
    label: '日期',
    type: 'daterange',
    field: 'shelfTime',
    required: true,
    otherOptions: {
      disabled: false,
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      pickerOptions: {
        shortcuts: [{
          text: '昨天',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '三天',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '一月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }]
      }
    }
  },
  {
    label: '昵称',
    type: 'input',
    field: 'userName'
  },
  {
    label: '会员ID',
    type: 'input',
    field: 'userId'
  },
]

export const formItemStyle = {
  paddingLeft: '20px'
}


// table
// 单元格样式
export const cellStyle = {
  background: 'rgba(28, 155, 252, 0.02)',
  color: 'rgb(142, 155, 185)',
  textAlign: 'center',
}

// 表头单元格样式
export const headerCellStyle = {
  background: 'rgba(28, 155, 252, 0.02)',
  color: 'rgb(142, 155, 185)',
  textAlign: 'center'
}

// 表格内表单子样式
export const tableFormStyle = {
  marginBottom: 0
}

// 表格项配置
export const tableBase = [
  {
    label: 'ID',
    prop: 'id'
  },
  {
    label: '仓库',
    prop: 'warehouseName',
    width: 150,
    operate: {
      type: 'select',
      field: 'warehouseId',
      optionsKey: 'warehouseName',
      optionsValue: 'id',
      options: store.state.custom_dict.warehouse
    }
  },
  {
    label: '到达时间',
    prop: 'entryTime',
    width: 150
  },
  {
    label: '快递号',
    prop: 'courierNumber',
    width: 150,
    operate: {
      type: 'input',
      field: 'courierNumber'
    }
  },
  {
    label: '入库员',
    prop: 'inventoryScanner',
    otherOptions: {},
    operate: {
      type: 'input',
      field: 'inventoryScanner'
    }
  },
  {
    label: '快递公司',
    prop: 'companyName',
    width: 150,
    operate: {
      type: 'select',
      field: 'companyId',
      optionsKey: 'companyName',
      optionsValue: 'id',
      options: store.state.custom_dict.company,
    }
  },
  {
    label: '会员号',
    prop: 'userId',
    otherOptions: {},
    operate: {
      type: 'input',
      field: 'userId',
    }
  },
  {
    label: '会员昵称',
    prop: 'userName',
    otherOptions: {},
    operate: {
      type: 'input',
      field: 'userName'
    }
  },
  {
    label: '客户登记时间',
    prop: 'createTime',
    width: 150
  },
  {
    label: '实重',
    prop: 'actualWeight',
    operate: {
      type: 'input',
      field: 'actualWeight'
    }
  },
  {
    label: '尺寸',
    prop: 'cargoDimensions',
    width: 150
  },
  {
    label: '存放库区',
    prop: 'locationName',
    width: '150'
  },
  {
    label: '是否上架',
    prop: 'isUp',
    operate: {
      type: 'switch',
      field: 'isUp',
      otherOptions: {
        activeValue: 1,
        inactiveValue: 0
      }
    }
  },
  {
    label: '上架时间',
    prop: 'shelfTime',
    width: 150
  },
  {
    label: '上架员工',
    prop: 'shelfEmployee',
    width: 150
  },
  {
    label: '是否申请',
    prop: 'appliedFor',
    operate: {
      type: 'switch',
      field: 'appliedFor',
      otherOptions: {
        activeValue: 1,
        inactiveValue: 0
      }
    }
  },
  {
    label: '是否确认',
    prop: 'confirmed',
    operate: {
      type: 'switch',
      field: 'confirmed',
      otherOptions: {
        activeValue: 1,
        inactiveValue: 0
      }
    }
  },
  {
    label: '确认时间',
    prop: 'confirmedTime',
    width: 150
  },
  {
    label: '订单号',
    prop: 'orderId',
    otherOptions: {},
    operate: {
      type: 'input',
      field: 'orderId'
    }
  },
  {
    label: '备注',
    prop: 'remarks',
    otherOptions: {},
    operate: {
      type: 'input',
      field: 'remarks'
    }
  },
  {
    label: '是否弃件',
    prop: 'isJettisons',
    operate: {
      type: 'switch',
      field: 'isJettisons',
      otherOptions: {
        activeValue: 1,
        inactiveValue: 0
      }
    }
  },
]
